﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ONNONLed5KSDKD;

namespace 智能仓库系统
{
    public partial class Area : Form
    {
        public Area()
        {
            InitializeComponent();
            是否单行.SelectedIndex = 0;
            换行方式.SelectedIndex = 0;
            运行模式.SelectedIndex = 0;
            显示特技.SelectedIndex = 0;
            运行速度.SelectedIndex = 0;
        }


        

        public static byte[] AreaText;
       
        public Led5kSDK.bx_5k_area_header bx_5k;
        private void button1_Click(object sender, EventArgs e)
        {
            bx_5k.AreaType = 0x06;
            bx_5k.AreaX = Convert.ToInt16(textBox1.Text);
            bx_5k.AreaX /= 8;
            bx_5k.AreaY = Convert.ToInt16(textBox2.Text);
            bx_5k.AreaWidth = Convert.ToInt16(textBox3.Text);
            bx_5k.AreaWidth /= 8;
            bx_5k.AreaHeight = Convert.ToInt16(textBox4.Text);

            bx_5k.Lines_sizes = Convert.ToByte(行间距.Text);

            byte[] RunMode_list = new byte[3];
            RunMode_list[0] = 0;
            RunMode_list[1] = 1;
            RunMode_list[2] = 2;
            int rl = 运行模式.SelectedIndex;
            bx_5k.RunMode = RunMode_list[rl];
            //bx_5k.RunMode = Convert.ToByte(comboBox3.SelectedIndex+1);

            bx_5k.Timeout = Convert.ToInt16(超时时间.Text);


            bx_5k.Reserved1 = 0;
            bx_5k.Reserved2 = 0;
            bx_5k.Reserved3 = 0;

            byte[] SingleLine_list = new byte[2];
            SingleLine_list[0] = 0x01;
            SingleLine_list[1] = 0x02;
            int sll = 是否单行.SelectedIndex;
            bx_5k.SingleLine = SingleLine_list[sll];
            //bx_5k.SingleLine = Convert.ToByte(comboBox1.SelectedIndex);

            byte []NewLine_list=new byte[2];
            NewLine_list[0] = 0x01;
            NewLine_list[1] = 0x02;
            int nl = 换行方式.SelectedIndex;
            bx_5k.NewLine = NewLine_list[nl];
            //bx_5k.NewLine = Convert.ToByte(comboBox2.SelectedIndex);


            byte[] DisplayMode_list=new byte[6];
            DisplayMode_list[0] = 0x01;
            DisplayMode_list[1] = 0x02;
            DisplayMode_list[2] = 0x03;
            DisplayMode_list[3] = 0x04;
            DisplayMode_list[4] = 0x05;
            DisplayMode_list[5] = 0x06;
            int dml = 显示特技.SelectedIndex;
            bx_5k.DisplayMode = DisplayMode_list[dml];
            //bx_5k.DisplayMode = Convert.ToByte(comboBox4.SelectedIndex);

            bx_5k.ExitMode = 0x00;


            bx_5k.Speed =(byte) 运行速度.SelectedIndex;
            //bx_5k.Speed=Convert.ToByte(comboBox5.SelectedIndex);

            bx_5k.StayTime = Convert.ToByte(停留时间.Text);
            
            AreaText = System.Text.Encoding.Default.GetBytes(显示内容.Text.Trim());
            bx_5k.DataLen = AreaText.Length;
            this.Close();
        }
        private void Area_Load(object sender, EventArgs e)
        {
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
            this.Dispose();
        }
    }
}
